package cn.springcloud.fix.demo.jvm;

public class JavaVMStackOOM {

    private void dontStop() {
        while (true) {
        }
    }

    private void stackLeakByThread() {
        while (true) {
            Thread thread = new Thread(() -> {
                dontStop();
            });
            System.out.println("新建线程");
            thread.start();
        }
    }

    public static void main(String[] args) {
        JavaVMStackOOM oom = new JavaVMStackOOM();
        oom.stackLeakByThread();
    }
}
